package com.junqi.live.room.application.controller;

import com.junqi.common.entity.AjaxResult;
import com.junqi.live.room.application.convert.LiveRoomDtoConvert;
import com.junqi.live.room.application.convert.LiveTypeDtoConvert;
import com.junqi.live.room.domain.bo.LiveRoomBo;
import com.junqi.live.room.domain.bo.LiveTypeBo;
import com.junqi.live.room.domain.service.LiveTypeDomainService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/liveType")
public class LiveTypeController {

    @Resource
    LiveTypeDomainService liveTypeDomainService;

    /**
     * 通用下拉查询
     * @return
     */
    @GetMapping("/list")
    public AjaxResult list(){
        List<LiveTypeBo> typeList = liveTypeDomainService.listAll();
        return AjaxResult.success(typeList.stream().map(m -> LiveTypeDtoConvert.INSTANCE.convertBoToDtO(m)).collect(Collectors.toList()));
    }


}
